<template>
  <div>
    <div style="height:20px;"></div>
    <FormPanel ref="from" :list="formList" @formChange="changeHandle" :isSubmitBtn="false" :collapse="false" labelWidth="110" />



  </div>
</template>
<script>
import moment from 'moment'
export default {
  data(){
    return{
      formList:this.createdFrom(),

    }
  },
  components:{
  },
  watch:{
    'data':{
      handler(newName,oldName){
        this.getDetail(newName)
      },
      deep:true
    }
  },
  props:['data'],
  methods:{
    createdFrom(){
      return [
        {
          type: 'BREAK_SPACE',
          label: '车辆信息',
        },
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'ownerCode',
          disabled:true,
          placeholder: '请输入',
        },
        {
          type: 'INPUT',
          label: '经销商名称',
          fieldName: 'dealerName',
          disabled:true,
          placeholder: '请输入',
        },
        {
          type: 'INPUT',
          label: '品牌名称',
          fieldName: 'brandName',
          disabled:true,
          placeholder: '请输入',
        },



       {
          type: 'INPUT',
          label: '车系名称',
          fieldName: 'seriesName',
          placeholder: '请输入',
          disabled:true
        },
        {
          type: 'INPUT',
          label: '车型名称',
          fieldName: 'modelName',
          placeholder: '请输入',
          disabled:true
        },
        {
          type: 'INPUT',
          label: '配置名称',
          fieldName: 'packageName',
          placeholder: '请输入',
          disabled:true
        },
        {
          type: 'INPUT',
          label: '选装名称',
          fieldName: 'optionName',
          placeholder: '请输入',
          disabled:true
        },

        {
          type: 'INPUT',
          label: '外饰',
          fieldName: 'colorName',
          placeholder: '请输入',
          disabled:true
        },
        {
          type: 'INPUT',
          label: '内饰',
          fieldName: 'trimName',
          placeholder: '请输入',
          disabled:true
        },
        {
          type: 'DATE',
          label: '出库月份',
          fieldName: 'productDate',
          disabled:true,
          placeholder: '请选择',
          dateType:'month'
        },
        {
          type: 'INPUT',
          label: '电池号',
          fieldName: 'batteryNo',
          disabled:true,
          placeholder: '请输入',
        },
        {
          type: 'INPUT',
          label: '电机号',
          fieldName: 'motorNo',
          disabled:true,
          placeholder: '请输入',
        },
      ]
    },

    seacherFun(){
      this.issearch=true;
    },
    changeHandle(val){

    },
    getDetail(data){
      for (let i in data) {
        this.formList.map(x => {
          if (i == x.fieldName) {
            x.initialValue = data[i];
          }
          if(i=='productDate'){
            x.initialValue=moment(data.productDate).format('YYYY-MM')
          }
        })
      }
    }

  }
}
</script>
